import { AbstractFactory } from "./Factory/AbstractFactory";
import { VictorianFantory } from "./Factory/VictorianFactory";
import { ModernFantory } from "./Factory/ModernFactory";
class Store {
  private factory: AbstractFactory;

  constructor(fac: AbstractFactory) {
    this.factory = fac;
  }

  public orderFurniture(): string {
    // 生产对应风格的一套家具
    const chair = this.factory.createChair();
    const sofa = this.factory.createSofa();
    const coffeeTable = this.factory.createCoffeeTable();

    return `${chair.sitOn()} ${sofa.lieOn()} ${coffeeTable.putOn("coffee")}`;
  }
}

// 现在客户想要一套维多利亚风格的家具
const vFactory = new VictorianFantory();
const store = new Store(vFactory);
console.log(store.orderFurniture());

const mFactory = new ModernFantory();
const store2 = new Store(mFactory);
console.log(store2.orderFurniture());